#!/bin/bash
#
mkdir /etc/yum.repos.d/backup
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/backup

mount /dev/sr0 /mnt &> /dev/null
echo "/dev/sr0 /mnt iso9660 defaults 0 0" >> /etc/fstab

cat << eof > /etc/yum.repos.d/local.repo
[centos7.9]
name=centos7.9
baseurl=file:///mnt
enabled=1
gpgcheck=0
eof

yum clean all
yum repolist
